package com.orange.score.activity.more;

import android.content.Context;
import android.content.res.Resources;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.orange.score.activity.entry.PageableAdapter;
import com.orange.score.model.match.Match;
import java.util.List;

public class FinalScoreAdapter extends PageableAdapter<Match>
{
  public FinalScoreAdapter(List<Match> paramList, Context paramContext)
  {
    super(paramList, paramContext);
  }

  private String getDayofMonth(String paramString)
  {
    String str;
    if ((paramString == null) || (paramString.length() < 8))
      str = "";
    while (true)
    {
      return str;
      str = paramString.substring(6, 8).concat("日");
    }
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    Holder localHolder;
    View localView;
    if (paramView != null)
    {
      localHolder = (Holder)paramView.getTag();
      if (paramInt % 2 != 0)
        break label176;
      paramView.setBackgroundColor(this.context.getResources().getColor(2131230739));
    }
    while (true)
    {
      while (true)
      {
        if (paramInt + this.startIndex < this.list.size())
          break label195;
        localView = null;
        return localView;
        localHolder = new Holder(this);
        paramView = LayoutInflater.from(this.context).inflate(2130903076, null);
        localHolder.rLayout = ((RelativeLayout)paramView.findViewById(2131558486));
        localHolder.leagueName = ((TextView)paramView.findViewById(2131558487));
        localHolder.date = ((TextView)paramView.findViewById(2131558488));
        localHolder.homeTeamName = ((TextView)paramView.findViewById(2131558489));
        localHolder.awayTeamName = ((TextView)paramView.findViewById(2131558491));
        localHolder.score = ((TextView)paramView.findViewById(2131558492));
        paramView.setTag(localHolder);
      }
      label176: paramView.setBackgroundColor(this.context.getResources().getColor(2131230746));
    }
    label195: Match localMatch = (Match)this.list.get(paramInt + this.startIndex);
    localHolder.homeTeamName.setText(localMatch.getHomeTeamName());
    localHolder.awayTeamName.setText(localMatch.getAwayTeamName());
    localHolder.leagueName.setText(localMatch.getLeagueName());
    String str1 = getDayofMonth(localMatch.getDate());
    localHolder.date.setText(str1);
    if (localMatch.needDisplayScore())
    {
      Object[] arrayOfObject1 = new Object[2];
      arrayOfObject1[0] = localMatch.getHomeTeamScore();
      arrayOfObject1[1] = localMatch.getAwayTeamScore();
      String str3 = String.format("%s:%s", arrayOfObject1);
      Object[] arrayOfObject2 = new Object[2];
      arrayOfObject2[0] = localMatch.getHomeTeamFirstHalfScore();
      arrayOfObject2[1] = localMatch.getAwayTeamFirstHalfScore();
      String str4 = String.format("(%s:%s)", arrayOfObject2);
      SpannableStringBuilder localSpannableStringBuilder = new SpannableStringBuilder();
      localSpannableStringBuilder.append(str3);
      localSpannableStringBuilder.append(str4);
      localSpannableStringBuilder.setSpan(new ForegroundColorSpan(-65536), 0, str3.length(), 17);
      localSpannableStringBuilder.setSpan(new ForegroundColorSpan(-16777216), str3.length(), localSpannableStringBuilder.length(), 17);
      localHolder.score.setText(localSpannableStringBuilder);
    }
    while (true)
    {
      while (true)
        localView = paramView;
      String str2 = localMatch.getStatusString();
      int i = localMatch.getMatchStatusColor();
      localHolder.score.setText(str2);
      localHolder.score.setTextColor(i);
    }
  }

  class Holder
  {
    TextView awayTeamName;
    TextView date;
    TextView homeTeamName;
    TextView leagueName;
    RelativeLayout rLayout;
    TextView score;
  }
}